define('components/tab/tab.tpl',['hdbr'], function(Handlebars) {
			return Handlebars.template({"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    return "<div class=\"sn-tab-container\">\r\n    <div class=\"sn-tab J_tab_render\">\r\n        <ul class=\"sn-tab-items\">\r\n        </ul>\r\n        <div class=\"sn-dropdown\"></div>\r\n        <div class=\"contentArea J_content_render\"></div>\r\n    </div>\r\n</div>";
},"useData":true})
		});
define('components/tab/tabItem.tpl',['hdbr'], function(Handlebars) {
			return Handlebars.template({"1":function(container,depth0,helpers,partials,data) {
    var helper;

  return "        <span class=\""
    + container.escapeExpression(((helper = (helper = helpers.icon || (depth0 != null ? depth0.icon : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"icon","hash":{},"data":data}) : helper)))
    + "\"></span>\r\n";
},"3":function(container,depth0,helpers,partials,data) {
    return "    <span class=\"sn-tabClose\"></span>\r\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) {
    var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {});

  return "<li class=\"J_item_click\">\r\n    <span class=\"iconBox\">\r\n"
    + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.icon : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "        "
    + ((stack1 = ((helper = (helper = helpers.title || (depth0 != null ? depth0.title : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"title","hash":{},"data":data}) : helper))) != null ? stack1 : "")
    + "\r\n    </span>\r\n"
    + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.closeable : depth0),{"name":"if","hash":{},"fn":container.program(3, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
    + "</li>";
},"useData":true})
		});

define('lib/requirejs/css.min!components/tab/tab',[],function(){});
/*
 * 组件-tab
 */
define('tab',[
	'jquery', 'hdb', 'eventTarget',
	'components/tab/tab.tpl',
	'components/tab/tabItem.tpl',
	'lib/requirejs/css.min!components/tab/tab.css'
], function($, Hdb, EventTarget, tpl, template) {
	var VERSION = '1.1.0';
//	var template = Hdb.compile(itemTpl);
	var itemSelectStr = '>.sn-tab-container>.sn-tab>.sn-tab-items>li';
	var objClass = function(options) {
		if(options.el) {
			if(options.el instanceof jQuery && options.el.length > 0) {
				this.$el = options.el;
			} else if(isDOM(options.el)) {
				this.$el = $(options.el);
			} else if(typeof(options.el) == 'string' && $(options.el).length > 0) {
				this.$el = $(options.el);
			}
		} else {
			this.$el = $("<div></div>");
		}
		this.options = options;
		this.originTab = {};
		this.tabItem = {};
		EventTarget.call(this);
		render.call(this);
		eventInit.call(this);
		var tabData = this.options.tabs[0];
		if(tabData.render) {
			originTabInit.call(this, tabData);
		}
		setTimeout($.proxy(function(e) {
			var $li = $(this.$el).find(itemSelectStr).first();
			if($li.length) {
				$li.trigger("click");
			}
		}, this), 200);
	};
	var render = function() {
		var $tpl = $(tpl());
		var tabDatas = this.options.tabs;
		for(var i = 0; i < tabDatas.length; i++) {
			var tabData = tabDatas[i];
			var num = Math.random().toString(36).substr(2, 9);
			var className = tabData.className ? tabData.className : 'sn-tab-item' + num;
			var title = tabDatas[i].title;
			this.options.tabs[i].className = className;
			this.tabItem[className] = title;
			$tpl.find('.sn-tab>.sn-tab-items').append(template(tabDatas[i]));
			$tpl.find('.sn-tab>.sn-tab-items>li:last').addClass(className);
		}
		this.$el.html($tpl);
		if(this.options.direction && this.options.direction === "vertical") {
			this.$el.addClass("sn-vertical");
			this.$el.find('.sn-tab .sn-tab-items > li').css({padding: 0});
		}
		if(this.options.className) {
			this.$el.find('>.sn-tab-container').addClass(this.options.className);
		}
		//多行配置项
		if(this.options.multiline && this.options.multiline === true && this.options.direction !== 'vertical') {
			multilineHanlerInit.call(this);
		}
	};
	var multilineHanlerInit = function() {
		var $dropdownBtn = this.$el.find('>.sn-tab-container>.J_tab_render>.sn-dropdown');
		var $li = this.$el.find(itemSelectStr);
		var liHeight = $li.first().height();
		var $ul = $li.parent(),
			ulHeight = $ul.height();
		if(ulHeight > liHeight) {
			$ul.css('padding-right', '30px');
			$dropdownBtn.show();
		} else {
			if(!$dropdownBtn.hasClass("sn-btnclose")) {
				$ul.css('padding-right', '0');
				$dropdownBtn.hide();
			}
		}
		$dropdownBtn.off().on('click', function() {
			if($dropdownBtn.hasClass("sn-btnclose")) {
				$ul.css('height', 'auto');
				$ul.css('overflow', 'visiable');
				$dropdownBtn.removeClass('sn-btnclose');
			} else {
				$ul.css('height', liHeight);
				$ul.css('overflow', 'hidden');
				$dropdownBtn.addClass('sn-btnclose');
			}
		});
		//		var containerWidth = this.$el.width();
		//		var liWidth = 0;
		//		$.each($li, function() {
		//			liWidth += $(this).outerWidth(true);
		//		})
		//		var $ul = this.$el.find('>.sn-tab-container>.J_tab_render>.sn-tab-items');

		//		if(containerWidth < liWidth) {
		//			$ul.css('padding-right', '30px');
		//			$dropdownBtn.show();
		//		}
	}

	var eventInit = function() {
		this.$el.off('click', itemSelectStr);
		// 最初写法，不作任何处理
		// this.$el.on('click', itemSelectStr, $.proxy(itemClick, this));

		// 双击时不触发单击事件，有延迟，不是最优选择
		// var timer = null;
		// var that = this;
		// this.$el.on('click', itemSelectStr, function (e) {
		//     clearTimeout(timer);
		//     timer = setTimeout(function () {
		//         itemClick.call(that, e);
		//     }, 300);
		// });
		// this.$el.on('dblclick', itemSelectStr,function (e) {
		//     clearTimeout(timer);
		//     itemClick.call(that, e);
		// });
		// 400ms内最多触发一次click
		var that = this;
		var onOff = true;
		var timer = null;
		this.$el.on('click', itemSelectStr, function(e) {
			clearTimeout(timer);
			onOff && itemClick.call(that, e);
			onOff = false;
			timer = setTimeout(function() {
				onOff = true;
			}, 400);
		});
		this.$el.on('click', '.sn-tab-container>.sn-tab>.sn-tab-items>li>.sn-tabClose', $.proxy(tabClose, this));
		$(window).on('resize', function() {
			sizeInit.call(that);
		});
	};
	var tabClose = function(e) {
		e.stopPropagation();
		var $li = $(e.target || e.currentTarget).closest("li");
		var index = $li.index();
		var tabData = this.options.tabs[index];
		var className = tabData.className;
		this.destroy(className, e);
		if(this.options.multiline && this.options.multiline === true) {
			multilineHanlerInit.call(this);
		}
	};
	var originTabInit = function(tabData) {
		var result = tabData.render(this.originTab);
		var index = this.$el.find('.active').index();
		var className = tabData.className;
		var $div = $('<div></div>');
		if(result instanceof jQuery) {
			$div.append(result);
			this.originTab[className] = {
				content: $div
			};
		} else if(typeof(result) !== 'object') {
			this.originTab[className] = {
				content: $('<div>' + result + '</div>')
			};
		} else if(typeof(result) == 'object') {
			result.content = $div.append(result.content);
			this.originTab[className] = result;
		}
		this.originTab[className].content.addClass(tabData.className);
		$('>.sn-tab-container>.J_tab_render>.contentArea', this.$el).append(this.originTab[className].content);
		// 滚动条处理
		sizeInit.call(this);
	};
	var itemClick = function(e) {
		var $src = $(e.target || e.currentTarget).closest(".J_item_click");
		var index = this.$el.find(itemSelectStr).index($src);
		var actIndex = this.$el.find('.active').index();
		var tabDatas = this.options.tabs;
		var tabData = tabDatas[index];
		var className = tabData.className;
		if(actIndex != -1) {
			var actTabData = tabDatas[actIndex];
			var actclassName = actTabData.className;
		}
		var $content = this.$el.find('>.sn-tab-container>.J_tab_render>.contentArea').find('.' + className);
		this.$el.find(itemSelectStr).removeClass('active');
		$src.addClass('active');
		if(actIndex != -1) {
			this.$el.find('>.sn-tab-container>.J_tab_render>.contentArea').find('.' + actclassName).css('display', 'none');
		}
		if($content.length != 0) {
			$content.css('display', 'block')
		} else {
			if(tabData.render) {
				originTabInit.call(this, tabData);
			}
		}
		if(tabData && tabData.click) {
			tabData['originTab'] = this.originTab;
			tabData.click(e, tabData);
		}
	};
	var itemDestroy = function(e, data) {};
	$.extend(objClass.prototype, EventTarget.prototype, {
		version: VERSION,
		//切换选项卡
		switchTab: function(title) {
			var _self = this;
			if(this.$el.find(itemSelectStr).length > 1) {
				$.each(this.tabItem, function(key, val) {
					var $li = null;
					if(key == title) {
						$li = _self.$el.find('.' + title);
						$li.click();
						return false;
					} else if(val == title) {
						$li = _self.$el.find('li:contains(' + title + ')');
						$li.click();
						return false;
					}

				})
			}
		},
		//销毁选项卡
		destroy: function(title, e) {
			var _self = this;
			if(_self.$el.find(itemSelectStr).length > 1) {
				var $li = null;
				$.each(this.tabItem, function(key, val) {
					if(key == title) {
						$li = _self.$el.find('.sn-tab-container>.sn-tab>.sn-tab-items>.' + title);
						return false;
					} else if(val == title) {
						$li = _self.$el.find('li:contains(' + title + ')');
						return false;
					}
				})
				if($li) {
					var index = $li.index();
					if(index != -1) {
						var data = _self.options.tabs[index];
						var className = data.className;
						$li.remove();
						_self.options.tabs.splice(index, 1);
						delete this.tabItem[className];
						_self.$el.find('>.sn-tab-container>.J_tab_render>.contentArea').find('.' + className).remove();
						itemDestroy.call(_self, e);
						_self.trigger('itemDestroy', e, data);
						if(_self.$el.find('.active').length == 0) {
							var $newLi = _self.$el.find('.sn-tab-container>.sn-tab>.sn-tab-items>.J_item_click:eq(' + index + ')');
							if($newLi.length == 0) {
								_self.$el.find('.sn-tab-container>.sn-tab>.sn-tab-items>.J_item_click:eq(' + (index - 1) + ')').trigger("click");
							} else {
								$newLi.trigger("click");
							}
						}
					}
				}
			}
		},
		//清除内存
		clear: function() {
			this.$el.find('.sn-tab-container').remove();
			for(var key in this) {
				delete this[key];
			}
		},
		resize: function () {
			sizeInit.call(this);
		},
		// 设置选项卡title
		setTitle: function(className, title) {
			this.tabItem[className] = title;
			for(var i = 0; i < this.options.tabs.length; i++) {
				if(this.options.tabs[i].className == className) {
					this.options.tabs[i].title = title;
					this.$el.find('.sn-tab-container>.sn-tab>.sn-tab-items>.J_item_click.' + className).find('a').text(title);
				}
			}
		},
		//创建选项卡
		createTab: function(title, render, param) {
			if(arguments.length == 0) {
				return;
			}
			var options = null;
			if(typeof(title) == 'object') {
				options = title;
			} else {
				options = {
					title: title,
					render: render,
					param: param
				}
			}
			var tabs = this.options.tabs;
			for(var i = 0; i < tabs.length; i++) {
				if(tabs[i].title == options.title) {
					return;
				}
			}
			var num = Math.floor(100 + Math.random() * 899);
			var className = options.className ? options.className : (options.param && options.param.className) ? options.param.className : 'sn-tab-item' + num;
			options.className = className;
			var icon = options.icon ? options.icon : (options.param && options.param.icon) ? options.param.icon : '';
			this.options.tabs = this.options.tabs.concat(options);
			this.tabItem[className] = options.title;
			var length = this.options.tabs.length;
			this.$el.find('.sn-tab-container>.sn-tab>.sn-tab-items').append(template(this.options.tabs[length - 1]));
			var $liLast = this.$el.find('.sn-tab-container>.sn-tab>.sn-tab-items>li:last');
			$liLast.addClass(className);
			$liLast.trigger("click");

			if(this.options.multiline && this.options.multiline === true) {
				multilineHanlerInit.call(this);
			}
		},
		//设置选项卡内容 
		content: function(html) {
			var index = this.$el.find(".sn-tab-container>.sn-tab>.sn-tab-items").find('.active').index();
			var $contentArea = this.$el.find('>.sn-tab-container>.J_tab_render>.contentArea');
			var className = (this.options.tabs)[index].className;
			if(this.lastDom) {
				this.lastDom.detach();
			}
			if($contentArea.find('.' + className).length != 0) {
				if(typeof(html) == 'object') {
					this.lastDom = html;
					$contentArea.find('.' + className).empty().append(html);
				} else {
					$contentArea.find('.' + className).html(html);
				}
			} else {
				if(typeof(html) == 'object') {
					this.lastDom = html;
					var $div = $('<div class="' + className + '"></div>');
					$div.append(html);
					$contentArea.append($div);
				} else {
					$html = $('<div class="' + className + '">' + html + '</div>');
					$contentArea.append($html);
				}
			}
		},
		render: function() {
			return this;
		}
	})
	var isDOM = function(obj) {
		return obj.tagName ? true : false;
	};

	var sizeInit = function() {
		if(!(this.options.direction && this.options.direction === "vertical") && this.options.fixedNav && this.$el.height()) {
			var containerHeihgt = this.$el.height();
			var navHeight = this.$el.find('>.sn-tab-container>.J_tab_render>.sn-tab-items').height();
			this.$el.find('>.sn-tab-container>.J_tab_render').height(containerHeihgt);
			this.$el.find('>.sn-tab-container').height(containerHeihgt);
			this.$el.find('>.sn-tab-container>.J_tab_render>.contentArea').height(containerHeihgt - navHeight);
		}
	};
	//解决ie下console.log()报错问题
	window.console = window.console || (function() {
		var c = {};
		c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile = c.clear = c.exception = c.trace = c.assert = function() {};
		return c;
	})();
	return objClass;
});

(function(c){var d=document,a='appendChild',i='styleSheet',s=d.createElement('style');s.type='text/css';d.getElementsByTagName('head')[0][a](s);s[i]?s[i].cssText=c:s[a](d.createTextNode(c));})
('@charset \"UTF-8\";\r\n\r\n/* 横向tab */\r\n.sn-tab { overflow: hidden;}\r\n.sn-tab .sn-tab-items { margin: 0; padding: 0; border-bottom: 1px solid #d0d6d9; font-size: 12px; }\r\n.sn-tab .sn-tab-items:after, .sn-tab .contentArea:after { clear: both; display:block; visibility: hidden; height: 0; content: \" \"; }\r\n.sn-tab .sn-tab-items > li { float:left; margin-bottom:-1px; list-style: none; position: relative; padding: 0 16px; }\r\n.sn-tab .sn-tab-items > li:hover .sn-tabClose {visibility: visible; cursor:pointer; }\r\n.sn-tab .sn-tab-items > li .iconBox { display: inline-block;cursor: pointer; height: 36px; line-height: 36px; color: #666; border-bottom: 2px solid transparent; text-decoration: none; outline: none; transition: background-color .4s ease-out,color .4s ease-out; }\r\n.sn-tab .sn-tab-items > li .iconBox:hover { border-bottom: 3px solid #0085d0; }\r\n.sn-tab .sn-tab-items > li.active .iconBox { border-bottom: 3px solid #0085d0; color: #0085d0; }\r\n.sn-tab .contentArea { margin: 0; padding: 0; font-size: 12px; overflow: auto;}\r\n.sn-tab .sn-dropdown{display:none;position: absolute;top: 19px; right: 23px;border: 1px solid #d0d6d9;width: 14px; height: 14px;background:  url();\r\n                    background-repeat:no-repeat;background-position: -1px -18px;}\r\n.sn-tab .sn-dropdown:hover{background:#e5f2fa url();\r\n                    background-repeat:no-repeat;background-position: -1px -18px;}\r\n.sn-tab .sn-dropdown:active{background:#ebeff2 url();\r\n                    background-repeat:no-repeat;background-position: -1px -18px;}\r\n.sn-tab .sn-btnclose{background-position: -1px 0px;}\r\n.sn-tab .sn-btnclose:hover{background:#e5f2fa url();\r\n                    background-repeat:no-repeat;background-position: -1px 0px;}\r\n.sn-tab .sn-btnclose:active{background:#ebeff2 url();\r\n                    background-repeat:no-repeat;background-position: -1px 0px;}\r\n\r\n/* 竖向tab，依赖sn-tab */\r\n.sn-vertical { border: 1px solid #d0d6d9; }\r\n.sn-vertical:after { clear: both; display:block; visibility: hidden; height: 0; content: \" \"; }\r\n.sn-vertical .sn-tab-items { width: 150px; float: left; display: block; margin-bottom: -1px; border-bottom: none; }\r\n.sn-vertical .sn-tab-items li { margin-bottom: 0; width: 100%; height: 36px; text-indent: 12px; border-bottom: 1px solid #d0d6d9; border-right: 1px solid #d0d6d9; }\r\n.sn-vertical .sn-tab-items li .iconBox { display: block; margin: 0; height: 36px; line-height: 36px; color: #666; background: #F6F6F6; border-bottom: 1px solid #d0d6d9; }\r\n.sn-vertical .sn-tab-items li .iconBox:hover { border-bottom: 1px solid #d0d6d9; }\r\n.sn-vertical .sn-tab-items li.active { border-right: 1px solid transparent; text-indent: 10px; }\r\n.sn-vertical .sn-tab-items li.active .iconBox { margin-left: -1px; color: #222; background: #fff; border-bottom: 1px solid #d0d6d9; border-left: 3px solid #0085d0; }\r\n.sn-vertical .sn-tab .contentArea { margin-left: 150px; }\r\n\r\n/*删除*/\r\n.sn-tab .sn-tab-items > li .sn-tabClose {\r\n    background: url(\'\') no-repeat center center;\r\n    display: inline-block;\r\n    width: 12px;\r\n    height: 20px;\r\n    margin-right: 1px;\r\n    position: absolute;\r\n    top: 1px;\r\n    right: 1px;\r\n    visibility: hidden;\r\n}');
